const { createCanvas, loadImage } = require('canvas')
const fs = require('fs');
const style=require("./style.json")

const layers=style.layers;
console.log(layers)

for (let i = 0; i <layers.length ; i++) {
    console.log(layers[i].paint)
}

const canvas = createCanvas(200, 200)
const context = canvas.getContext('2d')


context.font = '14px "Microsoft YaHei"' // 统一使用微软雅黑字体
context.fillText('Hellow', 84, 24, 204)
console.log()
// 生成图片3(把base64位图片编码写入到图片文件)
fs.writeFile('test.png', canvas.toBuffer(), function(err) {
    if(err) {console.log(err)}
});
